TEMPORALS
Photo by Akash Rai on Unsplash
I didn’t invent the hamburger. I just took it more seriously than anyone else…
— Ray Kroc, CEO, McDonald’s
# Load csv data file
df <- read.csv("archetypes/big-mac-by-country/big-mac-by-country.csv", header = TRUE, stringsAsFactors = FALSE)
df
df_wrangle <- df %>% filter(name != "United States", !is.na(usd_adjusted))
df_wrangle$date <- as.Date(df_wrangle$date, format = "%Y-%m-%d")
df_wrangle
theme_opts <- theme(
text = element_text(family = "inconsolata", size = 10),
plot.title = element_text(color = "black", size = 16, face = "bold"),
plot.subtitle = element_text(color = "black", size = 12),
plot.caption = element_text(color = "#555555", size = 10),
panel.border = element_blank(),
panel.background = element_blank(),
legend.position='none',
panel.spacing.x = unit(1, "lines"),
panel.spacing.y = unit(1, "lines"),
panel.grid.minor = element_blank(),
strip.text = element_text(size = 8.5, face = "bold"),
strip.background = element_blank()
)
# Plot
v1 <- ggplot(df_wrangle, aes(date, usd_adjusted)) +
geom_flame(aes(x = date, y2 = usd_adjusted, y = 0), fill = "#e63946") +
geom_flame(aes(x = date, y = usd_adjusted, y2 = 0), fill = "#52b788") +
scale_y_continuous(labels = scales::percent) +
geom_hline(yintercept = 0) +
facet_wrap(vars(name), ncol = 6) +
labs(title = "The Big Mac Index",
subtitle = "GDP adjusted index where currency is over (green) or under (red)-valued.",
caption = "Source: The Economist",
y = "GDP adjusted index, relative to the US dollar") +
theme_minimal() +
theme_opts
girafe(ggobj = v1, width_svg = 720/72, height_svg = 1280/72,
options = list(opts_sizing(rescale = TRUE, width = 0.75))
)